package com.example.dto;

import com.example.model.dto.BaseDTO;
import com.example.validator.group.AddGroup;
import com.example.validator.group.DefaultGroup;
import com.example.validator.group.UpdateGroup;
import jakarta.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;

import lombok.Data;

import java.util.Date;

/**
 * 购物车表
 *
 * @author yyyyjinying 1020066395@qq.com
 * @since 1.0-SNAPSHOT 2025-05-22
 */
@Data
@Schema(description = "购物车表")
public class CartDTO extends BaseDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @Null(message = "{id.null}", groups = AddGroup.class)
    @NotNull(message = "{id.require}", groups = UpdateGroup.class)
    @Schema(description = "购物车ID")
    private Long id;
    @Schema(description = "用户ID")
    private Long userId;
    @Schema(description = "商品类型：0=普通商品, 1=规格商品, 2=套餐商品")
    private Integer type;
    @Schema(description = "商品或套餐的主ID")
    private Long productId;
    @Schema(description = "规格组ID（用于规格商品）")
    private Long specGroupId;
    @Schema(description = "具体规格值（字符串格式，如 '颜色:红, 型号:大' 或 JSON字符串）")
    private String specValues;
    @Schema(description = "套餐包含的商品组合（字符串格式，如 '[{\"item_id\":1,\"num\":1},{\"item_id\":2,\"num\":2}]'）")
    private String packageItems;
    @Schema(description = "购买数量（如果是套餐，表示整个套餐的数量）")
    private Integer quantity;
}